const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.subscribeMessage.send({
      touser: event.openid,
      page: '/pages/index/say/say?title='+event.flag,
      data: {
        thing1: {
          value: event.title
        },
        name2: {
          value: event.huifuren
        },
        thing3: {
          value: event.huifuleirong
        },
        date4: {
          value: event.time
        }
      },
      templateId: 'AadcW-r08ZUw7Wl3oZsplWCs9oXLhJAlf25tC-4wuxo'
    })
    console.log(result)
    return result
  } catch (err) {
    console.log(err)
    return err
  }
}